ostree.git
11 years agorepo: detached sigs: Use error prefixing instead of overwriting
Colin Walters [Tue, 24 Feb 2015 18:39:22 +0000 (13:39 -0500)]
repo: detached sigs: Use error prefixing instead of overwriting

Noted when "rpm-ostree compose sign" failed to write to a repo due to
permissions.

11 years agoprepare-root: Move /sysroot instead of unmounting it
Colin Walters [Fri, 13 Feb 2015 02:01:23 +0000 (21:01 -0500)]
prepare-root: Move /sysroot instead of unmounting it

I originally thought this would fix a regression, but it turns out
this wasn't the bug.  But pushing anyways as it's just cleaner.

https://bugzilla.gnome.org/show_bug.cgi?id=743891

11 years agobuild: build libbupsplit separately
Giuseppe Scrivano [Mon, 23 Feb 2015 11:44:47 +0000 (12:44 +0100)]
build: build libbupsplit separately

It avoids gobject-introspection warnings:

src/libostree/bupsplit.h:42: Warning: OSTree: symbol='bupsplit_find_ofs': Unknown namespace for symbol 'bupsplit_find_ofs'
src/libostree/bupsplit.h:43: Warning: OSTree: symbol='bupsplit_selftest': Unknown namespace for symbol 'bupsplit_selftest'
src/libostree/bupsplit.h:33: Warning: OSTree: symbol='BUP_BLOBBITS': Unknown namespace for symbol 'BUP_BLOBBITS'
src/libostree/bupsplit.h:34: Warning: OSTree: symbol='BUP_BLOBSIZE': Unknown namespace for symbol 'BUP_BLOBSIZE'
src/libostree/bupsplit.h:35: Warning: OSTree: symbol='BUP_WINDOWBITS': Unknown namespace for symbol 'BUP_WINDOWBITS'
src/libostree/bupsplit.h:36: Warning: OSTree: symbol='BUP_WINDOWSIZE': Unknown namespace for symbol 'BUP_WINDOWSIZE'

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoostree-repo-static-delta-processing: initialize "modev"
Giuseppe Scrivano [Mon, 23 Feb 2015 10:51:48 +0000 (11:51 +0100)]
ostree-repo-static-delta-processing: initialize "modev"

Can be gs_unref_variant'ed on an early error.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoFix GObject introspection annotation
Giuseppe Scrivano [Mon, 23 Feb 2015 10:18:05 +0000 (11:18 +0100)]
Fix GObject introspection annotation

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoostree-repo-traverse.c: Fix documentation parameter name
Giuseppe Scrivano [Mon, 23 Feb 2015 11:47:47 +0000 (12:47 +0100)]
ostree-repo-traverse.c: Fix documentation parameter name

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agotests: Move test gpg keyring into writable tmpdir
Colin Walters [Mon, 23 Feb 2015 18:02:37 +0000 (13:02 -0500)]
tests: Move test gpg keyring into writable tmpdir

At least the version of gpgme in RHEL7 wants to create a lock file,
work around this by copying it into the writable test temporary
directory.

11 years agoAdd explicit zlib dependency
Matthew Barnes [Mon, 23 Feb 2015 19:47:56 +0000 (14:47 -0500)]
Add explicit zlib dependency

Needed for CRC32 computations.

11 years agorepo: Port APIs used by prune to fd-relative *at calls
Colin Walters [Fri, 20 Feb 2015 21:09:22 +0000 (16:09 -0500)]
repo: Port APIs used by prune to fd-relative *at calls

More of the general trend away from GFile * to the faster and more
secure world of *at().

11 years agolibglnx: Use git.gnome.org's copy
Colin Walters [Mon, 23 Feb 2015 03:30:53 +0000 (22:30 -0500)]
libglnx: Use git.gnome.org's copy

Not the master from my laptop.

11 years agocheckout: Drop internal use of GFile *
Colin Walters [Fri, 20 Feb 2015 21:36:02 +0000 (16:36 -0500)]
checkout: Drop internal use of GFile *

Checkout was one of the first complex code paths I tried to convert to
*at().  I ended up keeping both, because I hit the "xattrs for a
symlink" problem.  Later, Florian gave me a workaround, and we started
using it here, but the GFile * parameters weren't deleted.  They're
not used, so do so now.

11 years agodeploy: Also look for /usr/lib/os-release
Colin Walters [Fri, 13 Feb 2015 02:35:19 +0000 (21:35 -0500)]
deploy: Also look for /usr/lib/os-release

With newer versions of systemd, the file has moved there.

11 years agoUse libglnx
Colin Walters [Tue, 17 Feb 2015 22:38:36 +0000 (17:38 -0500)]
Use libglnx

Starting down the path of not using libgsystem.  The main win here
will be code sharing between ostree/rpm-ostree as well as going down
the path of not using GFile * for local files.

11 years agotests: do not run tests/test-rollsum as part of make check
Giuseppe Scrivano [Fri, 13 Feb 2015 10:50:37 +0000 (11:50 +0100)]
tests: do not run tests/test-rollsum as part of make check

it is not really a unit test.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Conflicts:
Makefile-tests.am

11 years agorepo: Check for OSTREE_REPO in ostree_repo_new_default()
Matthew Barnes [Thu, 19 Feb 2015 15:30:25 +0000 (10:30 -0500)]
repo: Check for OSTREE_REPO in ostree_repo_new_default()

Convenience feature to avoid having to pass --repo options repeatedly.

Before falling back to the default system repository path, check for a
repository path defined by the OSTREE_REPO environment variable.

11 years agolibostree: set directory mtimes to 0 on checkout
Daniel Drake [Wed, 18 Feb 2015 23:18:21 +0000 (17:18 -0600)]
libostree: set directory mtimes to 0 on checkout

We already set all file mtimes to 0 so that they are constant
over all checkouts, and can be made constant with a known value from
the system where the ostree was created.

However, this was not happening for directories. Zero their mtimes too.

This is important for shipping a fontconfig cache in the ostree;
the fontconfig cache files embed a directory mtime.

11 years agotests: Restore accidentally deleted Makefile bit
Colin Walters [Mon, 16 Feb 2015 15:29:14 +0000 (10:29 -0500)]
tests: Restore accidentally deleted Makefile bit

Not sure how this got deleted...

11 years agodeltas: Search for similar objects (possibly renamed across directories)
Colin Walters [Wed, 11 Feb 2015 08:29:14 +0000 (03:29 -0500)]
deltas: Search for similar objects (possibly renamed across directories)

The previous diff algorithm was file tree based, and only looked
at modified files that lived at the same path.

However, components like the Linux kernel have versioned
subdirectories, e.g. /usr/lib/modules/$kver/.../ext4.ko.  We want to
be able to detect these "modified renames" so that we can compute
diffs (rollsum, bsdiff).

11 years agorepo: Add a new iterator traversal API for commits
Colin Walters [Wed, 11 Feb 2015 08:25:17 +0000 (03:25 -0500)]
repo: Add a new iterator traversal API for commits

This is a more optimized version of the GFile * APIs, and is now used
internally by the previous ostree_repo_traverse().

11 years agodeltas: Prune deltas when the corresponding "to" commit vanishes
Colin Walters [Mon, 2 Feb 2015 18:04:52 +0000 (13:04 -0500)]
deltas: Prune deltas when the corresponding "to" commit vanishes

We want prune to actually give you back disk space when using deltas.

11 years agodeltas: Make syntax-check happy
Colin Walters [Sat, 31 Jan 2015 19:52:16 +0000 (14:52 -0500)]
deltas: Make syntax-check happy

11 years agodeltas: Implement rollsums
Colin Walters [Fri, 30 Jan 2015 15:13:07 +0000 (10:13 -0500)]
deltas: Implement rollsums

This does an rsync-style prepared delta basically.  On my test data,
it shaves ~6MB of uncompressed data.  Not a huge amount, but I expect
this to be more useful for things like binaries which embed data, etc.

11 years agodeltas: Initial code to copy content from existing objects
Colin Walters [Fri, 30 Jan 2015 04:00:51 +0000 (23:00 -0500)]
deltas: Initial code to copy content from existing objects

This is preparatory work for implementing rollsum support.

11 years agodeltas: Flesh out the open/write/close opcodes
Colin Walters [Fri, 30 Jan 2015 03:32:44 +0000 (22:32 -0500)]
deltas: Flesh out the open/write/close opcodes

Refactor open-splice-and-close to call open/close.  We can't just call
write as that would require duplicating the object size parameter.

11 years agodeltas: Use the new internal streaming APIs
Colin Walters [Fri, 6 Feb 2015 02:35:01 +0000 (21:35 -0500)]
deltas: Use the new internal streaming APIs

This is significantly more efficient.

11 years agodeltas: Stub out a few more opcodes
Colin Walters [Thu, 29 Jan 2015 22:54:59 +0000 (17:54 -0500)]
deltas: Stub out a few more opcodes

11 years agodeltas: Print total size of rollsums we would use
Colin Walters [Thu, 29 Jan 2015 22:54:41 +0000 (17:54 -0500)]
deltas: Print total size of rollsums we would use

11 years agodeltas: Compute rollsum targets
Colin Walters [Thu, 29 Jan 2015 22:39:34 +0000 (17:39 -0500)]
deltas: Compute rollsum targets

11 years agodeltas: Rework format to allow streaming
Colin Walters [Thu, 29 Jan 2015 06:03:55 +0000 (01:03 -0500)]
deltas: Rework format to allow streaming

There's still some silliness here, but there is now only one opcode
open-splice-and-close, that writes a single chunk from the payload.
This is really all we need for metadata, and small content objects are
also fine with this.

We get some deduplication between content objects by creating a
dictionary for (uid,gid,mode) tuples and xattrs.

This still keeps the operation/payload code in, so we could do
rollsums in a future update easily.

11 years agodeltas: Add _V0 to part #define
Colin Walters [Wed, 28 Jan 2015 22:42:59 +0000 (17:42 -0500)]
deltas: Add _V0 to part #define

To make more explicitly clear that this is the version that matches
the version in the metadata.

11 years agodeltas: Remove support for gzipped delta parts
Colin Walters [Wed, 28 Jan 2015 22:24:11 +0000 (17:24 -0500)]
deltas: Remove support for gzipped delta parts

XZ is really, really good.

11 years agodeltas: Use base64 for csums, add version to parts
Colin Walters [Mon, 26 Jan 2015 04:51:41 +0000 (23:51 -0500)]
deltas: Use base64 for csums, add version to parts

11 years agorepo: Store pending objects in prefixed subdirectory
Colin Walters [Sun, 15 Feb 2015 20:30:19 +0000 (15:30 -0500)]
repo: Store pending objects in prefixed subdirectory

I was hitting a bug in libguestfs/guestmount/FUSE where it blew up
with EINVAL on directories containing lots of files (more than
32000?).  We really want to use prefixed subdirs just like the real
objects/ directory does.

This allows us to share more code between the paths, is more
efficient, etc.

11 years agorepo: Fix major performance regression with --scan-hardlinks
Colin Walters [Fri, 13 Feb 2015 21:34:52 +0000 (16:34 -0500)]
repo: Fix major performance regression with --scan-hardlinks

gnome-continuous uses the ostree_repo_scan_hardlinks() mode to
avoid re-checksumming everything.  However, when I ported the commit
code to use openat() and friends, this optimization was lost.

Re add it.  The difference is about 15s versus 5 minutes.

11 years agopull-local: Fix regression with absolute paths
Colin Walters [Fri, 13 Feb 2015 16:39:02 +0000 (11:39 -0500)]
pull-local: Fix regression with absolute paths

Don't add cwd unless the path is relative.

11 years agoChange pull-local to just be a wrapper for pull with file:///
Colin Walters [Sun, 8 Feb 2015 09:30:52 +0000 (04:30 -0500)]
Change pull-local to just be a wrapper for pull with file:///

This follows up from the previous commit; now that pull knows how to
do the efficient link() or copy for local files, we can just have
pull-local call into ostree_repo_pull().

As part of this:
 - pull() can also accept a file:/// URI instead
   of a remote name (since pull local supports anonymous pulls)
 - pull() knows an "override-remote-name" option, since pull-local
   supported writing a ref out even if there wasn't a remote with
   that name

11 years agopull: Optimize file:/// URIs to skip libsoup and hardlink if possible
Colin Walters [Fri, 6 Feb 2015 15:02:57 +0000 (10:02 -0500)]
pull: Optimize file:/// URIs to skip libsoup and hardlink if possible

It's always been suboptimal to have both pull and pull-local; as we go
beyond the raw object data into things like deltas and summary files,
the logic to perform e.g. mirroring should only be in one place.

This will be used by Pulp's OSTree content plugin at least to perform
promotions.

11 years agoAdd an internal API to get a read fd for a content object
Colin Walters [Fri, 6 Feb 2015 02:49:49 +0000 (21:49 -0500)]
Add an internal API to get a read fd for a content object

This will be used by the static deltas work.

11 years agopull: Copy the upstream summary file when doing a pull --mirror
Colin Walters [Wed, 4 Feb 2015 19:49:22 +0000 (14:49 -0500)]
pull: Copy the upstream summary file when doing a pull --mirror

While it could be regenerated downstream, there might be other
metadata upstream, and the goal here is a mirror.

https://bugzilla.gnome.org/show_bug.cgi?id=739377

11 years agoWhen mirroring, write content directly, do not verify
Colin Walters [Sun, 1 Feb 2015 16:09:47 +0000 (11:09 -0500)]
When mirroring, write content directly, do not verify

When doing a pull --mirror from an archive-z2 repository into another
archive-z2 repository, currently we gunzip/checksum/gzip each content
object.  The re-gzip process in particular is fairly expensive.

This does assume that the upstream content is trusted and correct.
It'd be nice in the future to do at least a CRC check, if not the full
checksum.  (Could we append CRC data to the end of filez objects?)

We could also choose to only do this optimization if fetching over
TLS.

before: 1626 metadata, 20320 content objects fetched; 299634 KiB transferred in 62 seconds
after : 1626 metadata, 20320 content objects fetched; 299634 KiB transferred in 11 seconds

11 years agoAdd an internal API to stream content objects
Colin Walters [Fri, 30 Jan 2015 02:23:05 +0000 (21:23 -0500)]
Add an internal API to stream content objects

For future delta work where we do more interesting things than just
"tar of new objects", this lays the groundwork for doing streaming
writes into content objects.

It's also more efficient, as we avoid many intermediate allocations
and virtual calls.  Just a single `g_output_stream_write_all` for the
splice case.

Conflicts:
src/libostree/ostree-repo-private.h
src/libostree/ostree-repo-static-delta-processing.c

11 years agoutil: Add an API to atomic-replace a file, dirfd relative, optional fsync
Colin Walters [Wed, 4 Feb 2015 19:45:09 +0000 (14:45 -0500)]
util: Add an API to atomic-replace a file, dirfd relative, optional fsync

This can be used in other places too, but I plan to use it to write
the summary file.

11 years agorepo: Hold an fd "repo_dir_fd" open for the toplevel too
Colin Walters [Mon, 2 Feb 2015 19:56:39 +0000 (14:56 -0500)]
repo: Hold an fd "repo_dir_fd" open for the toplevel too

We could just make everything relative to this, but the objects/ and
tmp/ are accessed very often, so I think it's worth holding individual
fds.

This fd can cover everything else: refs, deltas, etc.

11 years agoprepare-root: Update comments
Colin Walters [Wed, 4 Feb 2015 10:32:45 +0000 (05:32 -0500)]
prepare-root: Update comments

11 years agoprepare-root: avoid double-stacked /sysroot mount
Daniel Drake [Mon, 2 Feb 2015 21:12:47 +0000 (15:12 -0600)]
prepare-root: avoid double-stacked /sysroot mount

prepare-root works with the mount that has been set up at /sysroot.
It creates a bind-mount within /sysroot (the deployment) and then moves
that mount to /sysroot.

Now we have 2 mounts both at /sysroot, and once we do switch_root, we will
never be able to unmount both of them. I'm not sure if this is ultimately
a kernel bug, but either way, ostree could do a bit more tidying up
after itself.
http://thread.gmane.org/gmane.linux.file-systems/92411

Easy way to reproduce:
1. Boot with rd.break param
2. At initramfs shell, run: ostree-prepare-root /sysroot
3. Observe two /sysroot mounts in /proc/mounts

Fix this by setting up the mounts at /sysroot.tmp, and unmounting the
original /sysroot before our new mount is MS_MOVEd on top of it.

11 years agopackaging: Add man5 pages
Colin Walters [Wed, 4 Feb 2015 01:28:18 +0000 (20:28 -0500)]
packaging: Add man5 pages

11 years agotests: Add tests for ot-unix-utils
Giuseppe Scrivano [Mon, 2 Feb 2015 12:37:48 +0000 (13:37 +0100)]
tests: Add tests for ot-unix-utils

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoconfigure.ac: Enable option subdir-objects for automake
Giuseppe Scrivano [Mon, 2 Feb 2015 12:00:32 +0000 (13:00 +0100)]
configure.ac: Enable option subdir-objects for automake

It silences an automake warning and keep the rootdir cleaner.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agotests: Move test-varint and test-rollsum under "make check"
Giuseppe Scrivano [Mon, 2 Feb 2015 11:56:40 +0000 (12:56 +0100)]
tests: Move test-varint and test-rollsum under "make check"

"make check" tests are always enabled and they do not require to be
installed.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agosyntax-check: Remove empty lines at the end of file
Giuseppe Scrivano [Mon, 2 Feb 2015 12:48:29 +0000 (13:48 +0100)]
syntax-check: Remove empty lines at the end of file

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agopull: use a single per-transaction syncfs instead of fsync
Giuseppe Scrivano [Thu, 22 Jan 2015 00:05:13 +0000 (01:05 +0100)]
pull: use a single per-transaction syncfs instead of fsync

Do not write directly to objects/ but maintain pulled files under tmp/
with a "tmpobject-$CHECKSUM.$OBJTYPE" name until they are syncfs'ed to
disk.

Move them under objects/ at ostree_repo_commit_transaction cleanup
time.

Before (test done on a local network):

$ LANG=C sudo time ./ostree --repo=repo pull origin master

0 metadata, 3 content objects fetched; 83820 KiB; 4 delta parts
fetched, transferred in 417 seconds
16.42user 6.73system 6:57.19elapsed 5%CPU (0avgtext+0avgdata
248428maxresident)k
24inputs+794472outputs (0major+233968minor)pagefaults 0swaps

After:

$ LANG=C sudo time ./ostree --repo=repo pull origin master

0 metadata, 3 content objects fetched; 83820 KiB; 4 delta parts
fetched, transferred in 9 seconds
14.70user 2.87system 0:09.99elapsed 175%CPU (0avgtext+0avgdata
256168maxresident)k
0inputs+794472outputs (0major+164333minor)pagefaults 0swaps

https://bugzilla.gnome.org/show_bug.cgi?id=728065

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoReplace "==" with "=" in shell script test
Giuseppe Scrivano [Fri, 30 Jan 2015 14:15:32 +0000 (15:15 +0100)]
Replace "==" with "=" in shell script test

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoDo not interleave spaces and tabs
Giuseppe Scrivano [Fri, 30 Jan 2015 14:14:42 +0000 (15:14 +0100)]
Do not interleave spaces and tabs

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoRemove magic argument numbers to exit(2)
Giuseppe Scrivano [Fri, 30 Jan 2015 14:12:43 +0000 (15:12 +0100)]
Remove magic argument numbers to exit(2)

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoRemove unused <dirent.h>
Giuseppe Scrivano [Fri, 30 Jan 2015 14:10:16 +0000 (15:10 +0100)]
Remove unused <dirent.h>

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoRemove unused include <assert.h>
Giuseppe Scrivano [Fri, 30 Jan 2015 14:09:19 +0000 (15:09 +0100)]
Remove unused include <assert.h>

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agosyntax-check: quote the first argument to AC_DEFINE
Giuseppe Scrivano [Fri, 30 Jan 2015 14:06:22 +0000 (15:06 +0100)]
syntax-check: quote the first argument to AC_DEFINE

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoRemove trailing dot from error message
Giuseppe Scrivano [Fri, 30 Jan 2015 14:04:11 +0000 (15:04 +0100)]
Remove trailing dot from error message

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoAdd infrastructure for "make syntax-check"
Giuseppe Scrivano [Fri, 30 Jan 2015 13:55:50 +0000 (14:55 +0100)]
Add infrastructure for "make syntax-check"

New files copied from the gnulib project.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoFix repeated words.
Giuseppe Scrivano [Fri, 30 Jan 2015 13:38:52 +0000 (14:38 +0100)]
Fix repeated words.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoFix make distcheck
Giuseppe Scrivano [Fri, 30 Jan 2015 13:19:04 +0000 (14:19 +0100)]
Fix make distcheck

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agopull: (trivial) Fix English in function name
Colin Walters [Sun, 25 Jan 2015 14:14:21 +0000 (09:14 -0500)]
pull: (trivial) Fix English in function name

s/writed/written/

11 years agoRelease 2015.3
Colin Walters [Fri, 23 Jan 2015 19:54:38 +0000 (14:54 -0500)]
Release 2015.3

11 years agoExplicitly label .origin files as configuration
Colin Walters [Thu, 22 Jan 2015 22:35:32 +0000 (17:35 -0500)]
Explicitly label .origin files as configuration

subscription-manager has a daemon that runs in a confined domain,
and it doesn't have permission to write usr_t, which is the default
label of /ostree/deploy/$osname/deploy.

A better long term fix is probably to move the origin file into the
deployment root as /etc/ostree/origin.conf or so.

In the meantime, let's ensure the .origin files are labeled as
configuration.

11 years agobuild: Add --disable-static-deltas
Colin Walters [Thu, 22 Jan 2015 21:19:11 +0000 (16:19 -0500)]
build: Add --disable-static-deltas

Since they're unstable, we want to allow organizations shipping ostree
now to be future proof against any changes.

11 years agopull: Further extend static delta progress
Colin Walters [Wed, 21 Jan 2015 22:53:52 +0000 (17:53 -0500)]
pull: Further extend static delta progress

With deltas, we have an accurate total size, among other things.

11 years agopull: Distingiush delta pulls from loose better
Colin Walters [Wed, 21 Jan 2015 14:13:12 +0000 (09:13 -0500)]
pull: Distingiush delta pulls from loose better

11 years agocommit: Fix segfault on async writes if object exists and checksum requested
Colin Walters [Thu, 22 Jan 2015 02:16:11 +0000 (21:16 -0500)]
commit: Fix segfault on async writes if object exists and checksum requested

If an object already existed and we somehow tried to pull it, the
caller would still expect a returned checksum.

This appears to happen with static deltas for some reason; we might be
including duplicate metadata objects.  Regardless, this is a bug that
should be fixed.

11 years agotraverse: Fix transfer on hash table
Colin Walters [Wed, 21 Jan 2015 16:58:31 +0000 (11:58 -0500)]
traverse: Fix transfer on hash table

Otherwise, bindings try to erroneously unref the key/values as well.

11 years agodeltas: Use trusted writes
Colin Walters [Wed, 21 Jan 2015 04:28:26 +0000 (23:28 -0500)]
deltas: Use trusted writes

We have a chain of checksums from the root up until here.  While doing
checksums of the objects individually would be a good redundancy check
for test cases and the like, when doing a pull there's no good reason
to burn cycles on SHA256.

11 years agodeltas: Drop async content writes
Colin Walters [Wed, 21 Jan 2015 04:21:26 +0000 (23:21 -0500)]
deltas: Drop async content writes

This caused deadlocks and/or EMFILE due to the interaction between
threads and fds.  What we really want here is a better pull-based
model for parsing content objects.

Another idea would be to change static deltas so that content objects
have a special opcode that includes their metadata first, and then do
rollsums etc. only over actual content.

11 years agodeltas: Unlink temporary metadata files before processing
Colin Walters [Wed, 21 Jan 2015 03:59:16 +0000 (22:59 -0500)]
deltas: Unlink temporary metadata files before processing

Leaking them is bad.

11 years agostatic-delta: limit the number of writes in process to 1
Giuseppe Scrivano [Fri, 16 Jan 2015 18:21:27 +0000 (19:21 +0100)]
static-delta: limit the number of writes in process to 1

This will avoid too many open files at the same time that could cause
an EMFILE error.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit bc092b06f0e34e93f7d6102957bf55fd7ffd1b9e)

11 years agostatic delta generation: Separate max chunk size from min fallback size
Alexander Larsson [Tue, 20 Jan 2015 13:11:47 +0000 (14:11 +0100)]
static delta generation: Separate max chunk size from min fallback size

There is no particular reason these have to be the same.

https://bugzilla.gnome.org/show_bug.cgi?id=721799

11 years agoadmin: Add set-origin command
Colin Walters [Fri, 16 Jan 2015 18:07:26 +0000 (13:07 -0500)]
admin: Add set-origin command

See projectatomic/rpm-ostree#42 for rationale. There are two high
level use cases:

 - If the OS comes unconfigured, this is a way to point it at a repo of your choice.
 - To switch between repositories while keeping the same branch easily.

11 years agosysroot: Add ostree_sysroot_write_origin_file() API
Colin Walters [Fri, 16 Jan 2015 18:04:29 +0000 (13:04 -0500)]
sysroot: Add ostree_sysroot_write_origin_file() API

We want to allow admins to change the origin file without doing a new
deployment, so this will be part of a future "admin set-origin"
command.

11 years agocmdline: (cleanup) Add internal helper to parse key=value options
Colin Walters [Fri, 16 Jan 2015 18:03:10 +0000 (13:03 -0500)]
cmdline: (cleanup) Add internal helper to parse key=value options

This will be used by a later "ostree admin set-origin" as well.

11 years agoadmin: (cleanup) Add internal API to find a deployment given an index
Colin Walters [Fri, 16 Jan 2015 17:57:39 +0000 (12:57 -0500)]
admin: (cleanup) Add internal API to find a deployment given an index

At some point, we might want to expose a uniform way to refer
to deployments by an index.  At the moment undeploy is the only
command that does.

I plan to introduce another command which optionally takes an index,
so prepare a helper function for this.

11 years agoeditor: honor arguments environment variable
Giuseppe Scrivano [Fri, 16 Jan 2015 10:48:50 +0000 (11:48 +0100)]
editor: honor arguments environment variable

My EDITOR looks like "EDITOR=emacs -nw", ensure that it is honored.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agostatic-delta: do not accept both --from=REV and --empty for generate
Giuseppe Scrivano [Wed, 14 Jan 2015 15:53:21 +0000 (16:53 +0100)]
static-delta: do not accept both --from=REV and --empty for generate

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agodoc: Manpage love for static-delta command
Matthew Barnes [Thu, 15 Jan 2015 20:49:49 +0000 (15:49 -0500)]
doc: Manpage love for static-delta command

11 years agodeltas: Use *at() for writes
Colin Walters [Thu, 15 Jan 2015 03:29:45 +0000 (22:29 -0500)]
deltas: Use *at() for writes

Yet another GFile* user goes away in a performance sensitive path.

11 years agopull: Delete processed delta parts
Colin Walters [Thu, 15 Jan 2015 03:18:00 +0000 (22:18 -0500)]
pull: Delete processed delta parts

Otherwise they stay around until a much later GC.

11 years agoChange OstreeFetcher to be dirfd-relative
Colin Walters [Thu, 15 Jan 2015 03:04:06 +0000 (22:04 -0500)]
Change OstreeFetcher to be dirfd-relative

This is a noticeable cleanup, and fixes another big user of GFile* in
performance/security sensitive codepaths.

I'm specifically making this change because the static deltas code was
leaking temporary files, and cleaning that up nicely would be best if
we were fd relative.

11 years agocore: Add an API to parse a content file using dirfd relative lookup
Colin Walters [Thu, 15 Jan 2015 03:03:02 +0000 (22:03 -0500)]
core: Add an API to parse a content file using dirfd relative lookup

This will be used for a later change to use openat() for the fetching
code.  Note that we drop the code to use mmap() - it was an attempt to
avoid keeping a fd open, but we do correctly close anyways.

11 years agochecksumutils: Support splicing stream to arbitrary checksum type
Colin Walters [Thu, 15 Jan 2015 03:01:54 +0000 (22:01 -0500)]
checksumutils: Support splicing stream to arbitrary checksum type

This will be used later by the metalink code; you can splice with a
NULL output stream to an arbitrary GChecksum instead of just a SHA256
one.

11 years agodeltas: (trivial) delete some debugging prints
Colin Walters [Wed, 14 Jan 2015 16:34:18 +0000 (11:34 -0500)]
deltas: (trivial) delete some debugging prints

They create too much noise.

11 years agoAllow creating and pulling static deltas starting from "empty"
Alexander Larsson [Tue, 13 Jan 2015 14:09:43 +0000 (15:09 +0100)]
Allow creating and pulling static deltas starting from "empty"

You create these with something like:
  ostree static-delta generate --empty --to=master

These will be automatically used during pull if no previous revision
exists in the target repo.

These work very much like the normal static deltas except they
are named just by the "to" revision. I.e:

deltas/94/f7d2dc23759dd21f9bd01e6705a8fdf98f90cad3e0109ba3f6c091c1a3774d

for a from-scratch to 94f7d2dc23759dd21f9bd01e6705a8fdf98f90cad3e0109ba3f6c091c1a3774d delta.

https://bugzilla.gnome.org/show_bug.cgi?id=721799

11 years agoFix ostree_repo_list_static_delta_names
Alexander Larsson [Tue, 13 Jan 2015 20:28:17 +0000 (21:28 +0100)]
Fix ostree_repo_list_static_delta_names

The current layout uses a prefix of two bytes as the initial dir
and a second directory inside that with the superblock. This
updates the list code to handle that.

https://bugzilla.gnome.org/show_bug.cgi?id=721799

11 years agodeltas: Do not traverse all objects, only both commits
Colin Walters [Wed, 14 Jan 2015 02:32:02 +0000 (21:32 -0500)]
deltas: Do not traverse all objects, only both commits

That's the way they were designed.  We really don't want to include
all intervening objects.

https://bugzilla.gnome.org/show_bug.cgi?id=721799

11 years agorepo: Fix bare-user file loads
Colin Walters [Mon, 12 Jan 2015 17:39:57 +0000 (12:39 -0500)]
repo: Fix bare-user file loads

Regression from 86764dbf007fca1e42aacb830e3c1911b198be6e

This function is kind of fiendish now that we have 3 cases, each of
which want to be optimized somewhat to only load what's necessary
(e.g. don't open the file if we don't have an output for stream
requested).

Clean things up so that BARE_USER and BARE are separate conditionals
that share as much as possible, and fix the bug that asserted we
were in BARE mode.

I tested this by running test-basic-user.sh by hand.

11 years agorepo: Deduplicate some code in load_file
Colin Walters [Mon, 12 Jan 2015 17:10:02 +0000 (12:10 -0500)]
repo: Deduplicate some code in load_file

11 years agoRelease 2015.2
Colin Walters [Thu, 8 Jan 2015 22:23:02 +0000 (17:23 -0500)]
Release 2015.2

11 years agoTwo 32 bit compilation fixes
Colin Walters [Thu, 8 Jan 2015 21:16:21 +0000 (16:16 -0500)]
Two 32 bit compilation fixes

11 years agorepo: Report metadata fetch progress separately
Matthew Barnes [Thu, 8 Jan 2015 19:43:01 +0000 (14:43 -0500)]
repo: Report metadata fetch progress separately

Partially resolves https://bugzilla.gnome.org/740276

11 years agopull: Prioritize fetching metadata objects over content objects
Matthew Barnes [Thu, 8 Jan 2015 19:11:12 +0000 (14:11 -0500)]
pull: Prioritize fetching metadata objects over content objects

11 years agofetcher: Add a priority value to async requests
Matthew Barnes [Thu, 8 Jan 2015 18:19:48 +0000 (13:19 -0500)]
fetcher: Add a priority value to async requests

11 years agoRelease 2015.1
Colin Walters [Thu, 8 Jan 2015 18:00:43 +0000 (13:00 -0500)]
Release 2015.1

11 years agoBump libgsystem dependency
Colin Walters [Thu, 8 Jan 2015 18:00:27 +0000 (13:00 -0500)]
Bump libgsystem dependency

11 years agocheckout: Add --fsync=false
Colin Walters [Tue, 6 Jan 2015 21:00:27 +0000 (16:00 -0500)]
checkout: Add --fsync=false

Some use cases for checkouts don't need to fsync during checkout.
Installer programs for example will just do a global fsync at the end.

In the future, the default "ostree admin" core could also be
rearchitected to only do a transaction commit right before reboot, and
do the fsync then.

https://bugzilla.gnome.org/show_bug.cgi?id=742482